package com.cn.pretty.web.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.cn.pretty.service.TokenService;

@Controller
public class IndexController {

	@Resource
	private TokenService tokenService;
	
	@RequestMapping(value = "/", method = RequestMethod.GET)
	public String defult( final HttpServletRequest request, final HttpServletResponse response ){
		final String token = this.tokenService.getToken();
		request.setAttribute( "token", token );
		return "/index";
	}
	
	@RequestMapping(value = "/index", method = RequestMethod.GET)
	public String index( final HttpServletRequest request, final HttpServletResponse response ){
		final String token = this.tokenService.getToken();
		request.setAttribute( "token", token );
		return "/index";
	}
}
